Example of @Commands Vs JavaScript

The following section is for a developer who wishes to migrate from XpertRule @commands to JavaScript.

@Commands Code JavaScript Code
@ASSIGN Grade = 'Director' #Grade.val("Director");
@IF ( Grade = 'Director' ) if ( #Grade.val() == "Director" )
@DEBUG 'Hello World' xpertrule.message('Hello World');
@DO Expenses #Expenses.run();
@Clear Grade #Grade.clear();
@IF ( Grade.isEmpty ) if ( #Grade.isEmpty() )
@DIM aName:S var aName;
@ASSIGN aName = 'Grade'

@ASSIGN !(aName) = 'Director'

var aName = "Grade";

dictionary.findObject(aName).val("Director");

@ENCOCDEDATAXML aStr #aStr.val(xpertrule.encodeData());
@ASSIGN StrArray[2] = 'Hello'

@If StrArray[2] = 'Hello'

#StrArray[2] = "Hello";

if ( #strArray[2] == "Hello" )

@IF Grade = 'Director'

@ASSIGN Department = 'Boardroom'

@ELSEIF Grade = 'Senior Manager'

@ASSIGN Department = 'Management'

@ELSE

@ASSIGN Department = 'Office'

@ENDIF

if ( #Grade == "Director" ) {

#Department.val("Boardroom");

} else if ( #Grade == "Senior Manager" ) {

#Department.val("Management");

} else {

#Department.val("Office");

}

@DIM loop:n

@FOR loop = 1 TO 10

@ASSIGN strArr[loop] = 'Empty'

@NEXT loop

var loop;

for ( loop = 1 ; loop <= 10 ; loop = loop + 1 ) {

#strArr.val()[loop] = "Empty" ;

}